<template>
  <div class="pLogin">
    <h1 class="title">login</h1>
    <el-form class="form">
      <el-form-item label="姓名">
        <el-input v-model="name" />
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="psd" type="password" />
      </el-form-item>
      <el-form-item>
        <el-button @click="login">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      name: "",
      psd: ""
    };
  },
  methods: {
    login() {
      localStorage.setItem("TOKEN", this.name + this.psd);
      this.$router.push("/");
    }
  }
};
</script>

<style lang="less">
.title {
  text-align: center;
}
.pLogin {
  .form {
    width: 300px;
    margin: 0 auto;
  }
}
</style>
